package com.video.myvideo.activity;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.video.myvideo.R;
import com.video.myvideo.UrlsKt;
import com.video.myvideo.custom.MyJzvdStd;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

/**
 * Created by LH on 2022-04-07.
 * Time: 2022-04-07  9:59
 */
public class SecondActivity extends AppCompatActivity {

    private MyJzvdStd myJzvdStd;



    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        myJzvdStd = findViewById(R.id.myJzvdVideo);

        myJzvdStd.setUp(UrlsKt.getVideos()[3], UrlsKt.getTitles()[3]);
        Glide.with(this).load(UrlsKt.getThumbnails()[3]).into(myJzvdStd.posterImageView);

        myJzvdStd.startVideo();

    }

    @Override
    protected void onResume() {
        super.onResume();
        Jzvd.goOnPlayOnResume();
    }

    @Override
    protected void onPause() {
        super.onPause();

        JzvdStd.goOnPlayOnPause();
    }

    @Override
    public void onBackPressed() {
        if (JzvdStd.backPress()) {
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        JzvdStd.releaseAllVideos();

    }
}
